package lambda;

/**
 * @author 江岸
 * @version V1.0
 * @ClassName: Product
 * @description:
 * @date 2020/11/315:34
 * @since V1.0
 */
public class Product  implements Runnable{
    private int age;
    private String name;

    public Product(int num ,String name){
        this.age = num;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Product setAgeReturn(int age) {
        this.age = age;
        return this;
    }

    public Product getObj() {
        this.age = age+10;
        return this;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void run(){
        System.out.println("run");
    }

    @Override
    public String toString() {
        return "Product{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }


    /*
     * Object本身没有实现Cloneable接口，所以不重写clone方法并且进行调用的话会发生 CloneNotSupportedException异常。
     */
    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
